import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ISystemListResponse } from '../pojo/system/i-settings';
import { IBaseResponse } from '../pojo/i-base-response';

@Injectable({
    providedIn: 'root'
})
export class ApiSystemService {
    constructor(
        private http: HttpClient
    ) {}

    /**
     * 获取系统分类列表
     */
    getSystemList(): Observable<ISystemListResponse> {
        return this.http
            .get<ISystemListResponse>('system/list')
    }


    getSystemDetail(category: string): Observable<IBaseResponse> {
        const params = new HttpParams()
            .set('category', category);
        return this.http.get<IBaseResponse>('system/detail', { params})
    }
    
}